OPENCV_PATH = /usr/local/Cellar/opencv/4.5.2_4

INC_PATH := -I$(OPENCV_PATH)/include/opencv4 

LIB_PATH := -L$(OPENCV_PATH)/lib 

LIBS := $(LIB_PATH) -lopencv_gapi -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_sfm -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_highgui -lopencv_datasets -lopencv_text -lopencv_plot -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_wechat_qrcode -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_dnn -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core

CC := g++
LD := g++
#-Werror -Wno-unused
CFLAGS := -std=c++11 -g -Wall -fmessage-length=0 -fPIC
TARGET := opencv-pil-resize
DEPS := $(shell find ./src -name "*.h*")
SOURCE := $(shell find ./src -name "*.c*")

OBJS = $(SOURCE:%.cpp=%.o)
$(warning $(SOURCE))

$(TARGET): $(OBJS)
	$(LD) $(CFLAGS) $(OBJS) $(LIBS) -o $(TARGET)

%.o: %.cpp $(DEPS)
	$(CC) $(CFLAGS) $(INC_PATH) -c $< -o $@

RM_OBJS := $(shell find ./src -name "*.o")
RM_OBJS += $(shell find ./src -name "*.d")

.PTHOY: clean
clean:
	rm -rf $(RM_OBJS) $(TARGET)